import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useHealthStore = defineStore(
  'health',
  () => {
    const describeContent = ref('')
    const effectContent = ref('')
    const faultContent = ref('')
    const serviceUrl = ref('')
    const timeAxisId = ref()
    const fileServer = ref('')
    const nodeId = ref('')
    const satelliteId = ref('')
    const satelliteName = ref('')

    function changeDescribeContent(params) {
      describeContent.value = params
    }

    function changeEffectContent(params) {
      effectContent.value = params
    }

    function changeFaultContent(params) {
      faultContent.value = params
    }

    function changeFileServer(params) {
      fileServer.value = params
    }

    function changeServiceUrl(params) {
      serviceUrl.value = params
    }
    function changetimeAxisId(params) {
      timeAxisId.value = params
    }
    function changeNodeId(params) {
      nodeId.value = params
    }
    function changeSatelliteId(params) {
      satelliteId.value = params
    }
    function changeSatelliteName(params) {
      satelliteName.value = params
    }
    return {
      describeContent,
      effectContent,
      faultContent,
      serviceUrl,
      fileServer,
      timeAxisId,
      nodeId,
      satelliteId,
      satelliteName,
      changeDescribeContent,
      changeEffectContent,
      changeFaultContent,
      changeServiceUrl,
      changeFileServer,
      changetimeAxisId,
      changeNodeId,
      changeSatelliteId,
      changeSatelliteName
    }
  },
  {
    persist: {
      enabled: true
    }
  }
)

export function useHealthStoreHook() {
  return useHealthStore()
}
